/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ged.impl;

import ged.BorderMargin;
import ged.GedPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Border Margin</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ged.impl.BorderMarginImpl#getMargin_top <em>Margin top</em>}</li>
 *   <li>{@link ged.impl.BorderMarginImpl#getMargin_bottom <em>Margin bottom</em>}</li>
 *   <li>{@link ged.impl.BorderMarginImpl#getMargin_left <em>Margin left</em>}</li>
 *   <li>{@link ged.impl.BorderMarginImpl#getMargin_right <em>Margin right</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BorderMarginImpl extends EObjectImpl implements BorderMargin
{
  /**
   * The default value of the '{@link #getMargin_top() <em>Margin top</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMargin_top()
   * @generated
   * @ordered
   */
  protected static final int MARGIN_TOP_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getMargin_top() <em>Margin top</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMargin_top()
   * @generated
   * @ordered
   */
  protected int margin_top = MARGIN_TOP_EDEFAULT;

  /**
   * The default value of the '{@link #getMargin_bottom() <em>Margin bottom</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMargin_bottom()
   * @generated
   * @ordered
   */
  protected static final int MARGIN_BOTTOM_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getMargin_bottom() <em>Margin bottom</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMargin_bottom()
   * @generated
   * @ordered
   */
  protected int margin_bottom = MARGIN_BOTTOM_EDEFAULT;

  /**
   * The default value of the '{@link #getMargin_left() <em>Margin left</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMargin_left()
   * @generated
   * @ordered
   */
  protected static final int MARGIN_LEFT_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getMargin_left() <em>Margin left</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMargin_left()
   * @generated
   * @ordered
   */
  protected int margin_left = MARGIN_LEFT_EDEFAULT;

  /**
   * The default value of the '{@link #getMargin_right() <em>Margin right</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMargin_right()
   * @generated
   * @ordered
   */
  protected static final int MARGIN_RIGHT_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getMargin_right() <em>Margin right</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMargin_right()
   * @generated
   * @ordered
   */
  protected int margin_right = MARGIN_RIGHT_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected BorderMarginImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return GedPackage.Literals.BORDER_MARGIN;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getMargin_top()
  {
    return margin_top;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMargin_top(int newMargin_top)
  {
    int oldMargin_top = margin_top;
    margin_top = newMargin_top;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GedPackage.BORDER_MARGIN__MARGIN_TOP, oldMargin_top, margin_top));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getMargin_bottom()
  {
    return margin_bottom;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMargin_bottom(int newMargin_bottom)
  {
    int oldMargin_bottom = margin_bottom;
    margin_bottom = newMargin_bottom;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GedPackage.BORDER_MARGIN__MARGIN_BOTTOM, oldMargin_bottom, margin_bottom));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getMargin_left()
  {
    return margin_left;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMargin_left(int newMargin_left)
  {
    int oldMargin_left = margin_left;
    margin_left = newMargin_left;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GedPackage.BORDER_MARGIN__MARGIN_LEFT, oldMargin_left, margin_left));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getMargin_right()
  {
    return margin_right;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMargin_right(int newMargin_right)
  {
    int oldMargin_right = margin_right;
    margin_right = newMargin_right;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GedPackage.BORDER_MARGIN__MARGIN_RIGHT, oldMargin_right, margin_right));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case GedPackage.BORDER_MARGIN__MARGIN_TOP:
        return getMargin_top();
      case GedPackage.BORDER_MARGIN__MARGIN_BOTTOM:
        return getMargin_bottom();
      case GedPackage.BORDER_MARGIN__MARGIN_LEFT:
        return getMargin_left();
      case GedPackage.BORDER_MARGIN__MARGIN_RIGHT:
        return getMargin_right();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case GedPackage.BORDER_MARGIN__MARGIN_TOP:
        setMargin_top((Integer)newValue);
        return;
      case GedPackage.BORDER_MARGIN__MARGIN_BOTTOM:
        setMargin_bottom((Integer)newValue);
        return;
      case GedPackage.BORDER_MARGIN__MARGIN_LEFT:
        setMargin_left((Integer)newValue);
        return;
      case GedPackage.BORDER_MARGIN__MARGIN_RIGHT:
        setMargin_right((Integer)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case GedPackage.BORDER_MARGIN__MARGIN_TOP:
        setMargin_top(MARGIN_TOP_EDEFAULT);
        return;
      case GedPackage.BORDER_MARGIN__MARGIN_BOTTOM:
        setMargin_bottom(MARGIN_BOTTOM_EDEFAULT);
        return;
      case GedPackage.BORDER_MARGIN__MARGIN_LEFT:
        setMargin_left(MARGIN_LEFT_EDEFAULT);
        return;
      case GedPackage.BORDER_MARGIN__MARGIN_RIGHT:
        setMargin_right(MARGIN_RIGHT_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case GedPackage.BORDER_MARGIN__MARGIN_TOP:
        return margin_top != MARGIN_TOP_EDEFAULT;
      case GedPackage.BORDER_MARGIN__MARGIN_BOTTOM:
        return margin_bottom != MARGIN_BOTTOM_EDEFAULT;
      case GedPackage.BORDER_MARGIN__MARGIN_LEFT:
        return margin_left != MARGIN_LEFT_EDEFAULT;
      case GedPackage.BORDER_MARGIN__MARGIN_RIGHT:
        return margin_right != MARGIN_RIGHT_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (margin_top: ");
    result.append(margin_top);
    result.append(", margin_bottom: ");
    result.append(margin_bottom);
    result.append(", margin_left: ");
    result.append(margin_left);
    result.append(", margin_right: ");
    result.append(margin_right);
    result.append(')');
    return result.toString();
  }

} //BorderMarginImpl
